﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HousingControlSelect1.ascx.cs" Inherits="ZLDC.Estate.UserControl.HousingControlSelect1" %>
  <link href="../js/jquery.autocomplete/jquery.autocomplete.css" rel="stylesheet" type="text/css" />

<script src="../js/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>

<script src="../js/jquery.autocomplete.js" type="text/javascript"></script>

<script type="text/javascript">
    $(function() {
        $('#iEstateName').autocomplete("../Handler/HandlerIndex.ashx?act=build_auto_list_string", {
            minChars: 2,
            max: 100,               //列表里的条目数
            width: 200,
            scroll: true,
            mustMatch: false,       // 是否必须匹配，没有则自动清除输下框的值
            matchContains: false,   //提示的宽度，溢出隐藏
            scrollHeight: 300,      //提示的高度，溢出显示滚动条
            extraParams: {
                ename: function() {
                    return escape($('#iEstateName').val());
                }
            }
        });
        $("#iEstateName").result(function(event, data, formatted) {
            // 选中下拉中某行的事件
            var objE = document.getElementById("hEstateName");
            var tmp = objE.value.toString();

            if (tmp.indexOf(',') < 0) {
                // 如 惠名大厦 爱国路 截取惠名大厦
                var strtmp = data.toString();
                               
                var len = 0;
                for (var i = 0; i < strtmp.length; i++) {
                    if (strtmp.charAt(i) == " " || strtmp.charAt(i) == "  ") {
                        len = i;
                        break;
                    }
                }
                if (len > 0)
                    strtmp = strtmp.substr(0, len);

                tmp = strtmp;
            }
            else {
                //截取到最后一个逗号
                tmp = tmp.substr(0, tmp.lastIndexOf(',') + 1) + data;
            }
            $("#iEstateName").val(tmp);
            objE.value = tmp;
        });
    });

    // 添加隐藏值
    function estateName_Keyup() {
        if (event.keyCode != 37 && event.keyCode != 39)//屏蔽光标键
        {
            var tmp = new String($('#iEstateName').val());
            var objE = document.getElementById("hEstateName");
            if (tmp.indexOf(',') == 0) {
                objE.value = tmp.substr(1, tmp.len() - 1);
            }
            objE.value = tmp;
        }
    }

    // 级联加载列表
    function loadCity(sCity1, sCity2) {
       
        var parentid = sCity1.value;
        if (parentid <= 0)
            return false;

        $.ajax({
            type: 'POST',
            url: '../Handler/HandlerIndex.ashx',
            data: 'act=area_list&parentid=' + parentid,
            timeout: '10000',
            error: function() {
                alert("修改失败！");
            }, success: function(json) {
                loadCity2CallBack(json, sCity2);
            }
        });
    }

    // 加载城市列表回调
    function loadCity2CallBack(response, sCity2) {
        var json = eval("(" + response + ")");
        var record = json.record;

        $("#" + sCity2).html("");
        var obj = document.getElementById(sCity2);
        LexunJS.selectAddOption(obj, "全部", 0);

        if (record == null || record.length == 0)
            return;

        var recordLength = record.length;
        for (var i = 0; i < recordLength; i++) {
            var sName = record[i].name;
            var sValue = record[i].id;

            LexunJS.selectAddOption(obj, sName, sValue);
        }
    }
</script>

    <div style="text-align: right; font-weight: bold;">
        <table width="100%" border="0" cellspacing="0" cellpadding="0" style="font-weight: bold;">
            <tr>
                <td style="width: 55%; text-align: left;">
                
                    &nbsp;<asp:RadioButton ID="rbUsageType1" GroupName="rbUsageType" Text="住宅" runat="server" Visible="false"
                         />
                    &nbsp;<asp:RadioButton ID="rbUsageType2" GroupName="rbUsageType" Text="写字楼" runat="server" Visible="false"
                         />
                    &nbsp;<asp:RadioButton ID="rbUsageType3" GroupName="rbUsageType" Text="商铺" runat="server" Visible="false"
                        />
                    &nbsp;<asp:RadioButton ID="rbUsageType4" GroupName="rbUsageType" Text="厂房" runat="server" Visible="false"
                          />
                    &nbsp;<asp:RadioButton ID="rbUsageType5" GroupName="rbUsageType" Text="民房" runat="server" Visible="false"
                         />
                        
                </td>
            </tr>
        </table>
        <div id="divSearch" style="margin-top: 5px;">
        <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
            <tr>
             <td height="25" align="right" bgcolor="#F7F7F7" style="white-space: nowrap;">
                    楼盘名称:
                </td>
                <td bgcolor="#FFFFFF" align="left"  style="white-space: nowrap;">
                   <input id="iEstateName" name="iEstateName" type="text" onkeyup="estateName_Keyup()" title="拼音首字母提示,支持多楼盘查询,用逗号分隔多个楼盘名称,比如:先录入'ljgj',再按回车键选中'丽晶国际',接着按',fgy',再选择出现的楼盘,栋阁列表默认第一个楼盘的栋阁.如果录入'桃源%',将模糊查找所有'桃源'开始的楼盘.注:请勿用全角的逗号和百分号,列表提示只支持最后一个楼盘的拼音首字母和汉字.例子:1.丽晶国际,富瑰园,2.桃源%,3.丽晶国际,桃源%" />
<input id="hEstateName" name="hEstateName" type="hidden" />
                </td>
                
                <td height="25" align="center" bgcolor="#FFFFFF" colspan="8">
                    钥匙<input id="cbHasKey" name="cbHasKey" type="checkbox"  />&nbsp; 独家<input id="cbIsOnly"
                        name="cbIsOnly" type="checkbox" />&nbsp; 有图<input id="cbHasPhoto" name="cbHasPhoto"
                            type="checkbox" />&nbsp; 红本<input id="cbPocStatus" name="cbPocStatus" type="checkbox" />&nbsp;
                    满5年免税<input id="cbMark2" name="cbMark2" type="checkbox" />
                </td>
            </tr>
            <tr>
               <td width="10%" height="25" align="right" bgcolor="#F7F7F7" style="white-space: nowrap;">
                            价格:
                        </td>
                        <td width="20%" bgcolor="#FFFFFF"  align="left"  style="white-space: nowrap;">
                            <input id="iPrice1" name="iPrice1" type="text" style="width: 40px;" onkeyup="LexunJS.checkNum(this)" />
                            ~
                            <input id="iPrice2" name="iPrice2" type="text" style="width: 40px;" onkeyup="LexunJS.checkNum(this)" /><font
                                color="red"><span id="spanTradeTypeUnit">万元</span></font>
                        </td>
                        
                <td width="8%" height="25" align="right" bgcolor="#F7F7F7" style="white-space: nowrap;">
                    户型:
                </td>
                <td width="22%" bgcolor="#FFFFFF" align="left"  style="white-space: nowrap;">
                    <select id="sRoom" name="sRoom" runat="server">
                        <option value="0">全部</option>
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="3">3</option>
                        <option value="4">4</option>
                        <option value="5">5</option>
                        <option value="6">6</option>
                        <option value="7">7</option>
                        <option value="8">8</option>
                        <option value="9">9</option>
                    </select>房
                    <select id="sHall" name="sHall" runat="server">
                        <option value="0">全部</option>
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="3">3</option>
                        <option value="4">4</option>
                        <option value="5">5</option>
                        <option value="6">6</option>
                        <option value="7">7</option>
                        <option value="8">8</option>
                        <option value="9">9</option>
                    </select>厅
                </td> <td height="25" align="right" bgcolor="#F7F7F7" style="white-space: nowrap;">
                            城区:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <select id="sCity2" name="sCity2" runat="server" style="width: 80px;" onchange="return loadCity(this, 'HousingControlSelect1_sCity3')">
                            </select>
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7" style="white-space: nowrap;">
                            片区:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <select id="sCity3" name="sCity3" runat="server" style="width: 80px;">
                            </select>
                        </td>
                <td width="10%" height="25" align="right" bgcolor="#F7F7F7" style="white-space: nowrap;">
                    交易:
                </td>
                <td width="25%" bgcolor="#FFFFFF"  align="left" >
                    <select id="sTradeType" name="sTradeType" runat="server" style="width: 60px;" >
                        <option value="0">全部</option>
                        <option value="1">出售</option>
                        <option value="2">出租</option>
                    </select>
                  
                </td>
            </tr>
        </table> <input id="hIsUsage" name="hIsUsage" value="0" type="hidden" runat="server" /><!-- 0表示登录者为住宅业务员 1表示登录者为商铺业务员 -->   
    </div>
    </div>